<?php
include_once "../public/head.php";
$b = isset($_GET['fenlei'])?$_GET['fenlei']:"";
$a = isset($_GET['keywords'])?$_GET['keywords']:"";
@mysql_connect('localhost', 'root', 'root');
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "select * from `writing` where `title` like '%$a%'";
$res = mysql_query($sql);
$sqla ="select * from `lanmu`" ;
$resa = mysql_query($sqla);
while ($rowsa = mysql_fetch_assoc($resa)) {
    $arra[] = $rowsa;
}
while ($rows = mysql_fetch_assoc($res)) {
    $arr[] = $rows;
}
if (!isset($arr)) {
    die( "<script>alert('没有找到');window.location.href='index.php'</script>");
}
?>
<div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="../index.php">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">博文管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="index.php" method="get">
                    <table class="search-tab">
                        <tr>
  
                            <th width="70">分类:</th>
                            <td><select name="fenlei" id="title">
                            <?php 
                             foreach ($arra as $v) {
                              echo  '<option value="'.$v['name'].'">'.$v['name'].'</option>';
                            }
                             ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
  
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="add.php"><i class="icon-font"></i>新增作品</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                            <th>ID</th>
                            <th>分类</th>
                            <th>pic</th>
                            <th>标题</th>
                            <th>内容</th>
                            <th>状态</th>
                            <th>发布时间</th>
                            <th>操作</th>
                        </tr>
                        <?php
                    foreach ($arr as $v) {
                        echo '<tr>    <td class="tc"><input name="id[]" value="59" type="checkbox"></td>
                            <td>' . $v['id'] . '</td>
                            <td>' . $v['fenlei'] . '</td>
                            <td><img src="/public/pic/'.$v['pic'].'" alt="..." width="100"></td>
                            <td>' . substr($v['title'],0,30)  . '</td>
                            <td>' . mb_substr(strip_tags($v['content']) , 0,50) . '</td>
                            <td>' . $v['state'] . '</td>
                            <td>' . date('Y-m-d h:i:s', $v['ctime']) . '</td>
                            <td>
                                <a class="link-update" href="update.php?id=' . $v['id'] . '">修改</a>
                                <a class="link-del" href= del.php?id=' . $v['id'] . '>删除</a>
                            </td>
                        </tr>';
}
?>
                    </table>
                    <div class="list-page"> 2 条 1/1 页</div>
                </div>
            </form>
        </div>
    </div>


 <?php
include_once "../public/after.php";

?>